import { EditBox } from 'cc';
import { _decorator, Component, Node } from 'cc';
import AbstractComponent from '../../base/AbstractComponent';
import { Label } from 'cc';
import UtilTool from '../../tools/UtilTool';
import { App } from '../../App';
const { ccclass, property } = _decorator;

@ccclass('InputPwd')
export class InputPwd extends AbstractComponent {

    @property(Label)
    label_room_number : Label = null; // 房间号

    @property(EditBox)
    editBox : EditBox = null; // 输入框

    callback : Function = null;

    
    show(callback, roomNumber) {
        this.callback = callback;

        let roomNumberStr = UtilTool.getRoomNumStr(roomNumber)
        this.label_room_number.string = UtilTool.formatStr(App.language.getLanguageLab(118), roomNumberStr)
        
    }

    onBtnClose() {
        this.node.destroy();
    }

    onBtnOk() {
        this.callback && this.callback(this.editBox.string);
        this.node.destroy();
    }

}

